package com.bw.vip.vm

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.common.entity.BaseRes
import com.bw.common.vm.BaseViewModel
import com.bw.vip.entity.VipEntity
import com.bw.vip.modle.VipRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
class VipViewModel @Inject constructor(private val repo:VipRepository):BaseViewModel() {
    val mVipSuccess = MutableLiveData<VipEntity>()

    fun getVipData(id:Int){
        viewModelScope.launch(mDispatcher) {
            val res = repo.loadVipData(id)
            val res1 = BaseRes(
                code = 0,
                data = listOf(res),
                message = "成功"
            )
            mVipSuccess.postValue(res1.data[0])

        }
    }
}